package com.hosever.designPattern.singleton;

import java.util.Vector;

/**
 * 采用"影子实例"的办法为单例对象的属性同步更新
 * @author Administrator
 *
 */
public class SingletonShadow {  
	  
    private static SingletonShadow instance = null;  
    private Vector properties = null;  
  
    public Vector getProperties() {  
        return properties;  
    }  
  
    private SingletonShadow() {  
    }  
  
    private static synchronized void syncInit() {  
        if (instance == null) {  
            instance = new SingletonShadow();  
        }  
    }  
  
    public static SingletonShadow getInstance() {  
        if (instance == null) {  
            syncInit();  
        }  
        return instance;  
    }  
  
    public void updateProperties() {  
        SingletonShadow shadow = new SingletonShadow();  
        properties = shadow.getProperties();  
    }  
}  
